package com.usoft.thrift.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.usoft.thrift.server.ThriftServiceServerFactory;

import java.util.Map;

/**
 * Created by xinxingegeya on 16/3/2.
 */
public class GreetServer {

    public static void main(String args[]) throws InterruptedException {
        ApplicationContext factory = new ClassPathXmlApplicationContext(new String[]{"spring-server.xml"});
        factory.getBean("greetService");

        while (true) {

            Map<String, ThriftServiceServerFactory> map = factory.getBeansOfType(ThriftServiceServerFactory.class);

            for (Map.Entry<String, ThriftServiceServerFactory> entry : map
                .entrySet()) {
                System.out.println("serviceIml:" + entry.getKey());
                System.out.println("====" + entry.getValue().getMonitorInfo());
            }

            Thread.sleep(5000);
        }
    }
}
